screen.setSpaceBetweenScreens(10)

mustCountFPS = true

startDrawing = function()
   screen.startDrawing2D()
end

stopDrawing = function()
   -- Count FPS
   if mustCountFPS then 
      NB_FPS_COUNTER = NB_FPS_COUNTER + 1
      mustCountFPS = false
   else
      mustCountFPS = true
   end
   if tmrFpsCounter:time() >= 1000 then
      NB_FPS = NB_FPS_COUNTER
      NB_FPS_COUNTER = 0
      tmrFpsCounter:reset()
      tmrFpsCounter:start()
   end
   -- Draw debug console
   if Debug.isDebugOn then
      screen.drawTextBox(SCREEN_DOWN, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, Debug.debugText, Debug.debugColor)
   end
   screen.endDrawing()
   screen.waitForVBL()      
end

render = function()
   stopDrawing()
   startDrawing()
end

-- bold
function screen.printB (scr, x, y, texte, color)
  if color == nil then color = Color.new (31, 31, 31) end
  screen.print (scr, x, y, texte, color)
  screen.print (scr, x+1, y, texte, color)
end

-- underlined
function screen.printU (scr, x, y, texte, color)
  if color == nil then color = Color.new (31, 31, 31) end
  screen.print (scr, x, y, texte, color)
  if texte~=nil or texte~="" then
    local txtnum = string.len (texte)
    local x2 = x+txtnum*6
    screen.drawLine (scr, x, y+10, x2, y+10, color)
  end
end

-- strike
function screen.printS (scr, x, y, texte, color)
  if color == nil then color = Color.new (31, 31, 31) end
  screen.print (scr, x, y, texte, color)
  if texte~=nil or texte~="" then
    local txtnum = string.len (texte)
    local x2 = x+txtnum*6
    screen.drawLine (scr, x, y+4, x2, y+4, color)
  end
end
